package com.suda.catalina.myapplication;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.widget.Toast;

/**
 * Created by gzy on 2016/3/17.
 */
public class Sqlite extends SQLiteOpenHelper {

    private final static String CREATE_USRE = "create table user (id Integer primary key autoincrement, name text, password text)";
    private Context mContext;

    public Sqlite(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
        mContext = context;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        //创建数据库
        db.execSQL(CREATE_USRE);
        Toast.makeText(mContext, "成功创建数据库", Toast.LENGTH_SHORT).show();

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
